package com.ming.yygh.hosp.controller;

import com.ming.yygh.common.result.Result;
import com.ming.yygh.hosp.service.DepartmentService;
import com.ming.yygh.vo.hosp.DepartmentVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author Light
 * @date 2021/12/7 11:04
 */
@Api(tags = "科室相关接口")
@RestController
@RequestMapping("admin/hosp/department")
//@CrossOrigin
public class DepartmentController {

    @Resource
    DepartmentService departmentService;

    // 根据医院编号，查询医院所有科室列表
    @ApiOperation(value = "根据医院编号，查询医院所有科室列表")
    @GetMapping("/getDeptList/{hosCode}")
    public Result getDeptList(@PathVariable(value = "hosCode") String hosCode) {
        List<DepartmentVo> departmentVoList = departmentService.findDeptTree(hosCode);
        return Result.ok(departmentVoList);
    }
}
